library(plotly)
library(tidyr)
library(dplyr)
data("mtcars")
plot_ly(mtcars, x= ~wt, y=~mpg, mode="markers", color = as.factor(mtcars$cyl))
plot_ly(mtcars, x= ~wt, y=~mpg, mode="markers", color = mtcars$disp)
plot_ly(mtcars, x= ~wt, y=~mpg, mode="markers", color = as.factor(mtcars$cyl), size = mtcars$hp)
data("EuStockMarkets")
stocks<- as.data.frame(EuStockMarkets)%>%
gather(index, price) %>%
mutate(time=rep(time(EuStockMarkets),4))
plot_ly(stocks, x= ~time, y= ~price, color= stocks$index)
plot_ly(iris, y= ~Petal.Length, color = iris$Species, type="box")
data("diamonds")
p<-ggplot(data= diamonds, aes(carat, price))+
geom_point(aes(text=paste("Clarity:", clarity)), size=4)+
geom_smooth(aes(colour=cut, fill=cut))+facet_wrap(~cut)
ggplotly(p)